package com.geralt.im.command;

import java.util.ArrayList;
import java.util.Map;

import com.geralt.im.commandenum.Code;
import com.geralt.im.model.Message;
import com.geralt.im.protocol.Response;
import com.geralt.im.server.ClientSession;
import com.geralt.im.server.ObjectClientSession;

public abstract class Command {

	public abstract Response excute();
	
	protected ClientSession session;
	
	protected Map<String,Object> parameter;
	
	protected ArrayList<String> receivers;
	
	public Command(){
		receivers = new ArrayList<String>();
	}
	
	public Response getBadRequest(String message){
		Response response = new Response();
		response.setStatusCode(Code.BAD_REQUEST);
		response.setType("SEND");
		Message msg = new Message();
		msg.setContent(message);
		response.getParameter().put("MESSAGE", msg);
		return response;	
	}

	public Map<String, Object> getParameter() {
		return parameter;
	}


	public void setParameter(Map<String, Object> parameter) {
		this.parameter = parameter;
	}


	public ArrayList<String> getReceivers() {
		return receivers;
	}
	
	public void setReceivers(ArrayList<String> receivers) {
		this.receivers = receivers;
	}

	public ClientSession getSession() {
		return session;
	}

	public void setSession(ClientSession session) {
		this.session = session;
	}
	
}
